package spring_learn.a06;

import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor;
import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
import org.springframework.context.support.GenericApplicationContext;

public class A06 {


    /*
            1. Aware 接口用于注入一些与容器相关信息, 例如
                a. BeanNameAware 注入 bean 的名字
                b. BeanFactoryAware 注入 BeanFactory 容器
                c. ApplicationContextAware 注入 ApplicationContext 容器
                d. EmbeddedValueResolverAware ${}


              后处理器，属于拓展功能，某些情况下，可能会失效
              而使用 实现aware接口实现注入的方式，属于内置功能，不会失效

         */
    public static void main(String[] args) {
        GenericApplicationContext genericApplicationContext=new GenericApplicationContext();
        //genericApplicationContext.registerBean(MyBean.class);
        genericApplicationContext.registerBean(CommonAnnotationBeanPostProcessor.class);
        genericApplicationContext.registerBean(AutowiredAnnotationBeanPostProcessor.class);
        genericApplicationContext.registerBean(ConfigurationClassPostProcessor.class);
        genericApplicationContext.registerBean(Myconfig1.class);
        genericApplicationContext.registerBean(Myconfig2.class);
        genericApplicationContext.refresh();
        genericApplicationContext.close();
    }
}
